package app.server.project.main.service.controller;

import app.server.project.core.http.RespModel;
import app.server.project.main.service.dto.device.BoolReq;
import app.server.project.main.service.service.DevMgrService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 设备控制模块
 */
@AllArgsConstructor
@RestController
@RequestMapping("/device/mgr")
public class DevMgrController {

    private DevMgrService devMgrService;

    /**
     * 打开设备,或者关闭
     * @param req
     * @return
     */
    @PostMapping("/open")
    public RespModel open(@RequestBody BoolReq req){
        this.devMgrService.open(req);
        return RespModel.success();
    }
}
